<%-- 
    Document   : index
    Created on : Dec 26, 2013, 6:31:33 AM
    Author     : Nigga
--%>


<%@page import="javax.jms.Destination"%>
<%@page import="javax.jms.MessageProducer"%>
<%@page import="javax.jms.Connection"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="javax.jms.DeliveryMode"%>
<%@page import="javax.jms.TextMessage"%>
<%@page import="javax.jms.QueueSender"%>
<%@page import="javax.jms.Session"%>
<%@page import="javax.jms.QueueSession"%>
<%@page import="javax.jms.QueueConnectionFactory"%>
<%@page import="javax.jms.QueueConnection"%>
<%@page import="javax.jms.Queue"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
            InitialContext ic = new InitialContext();
            QueueConnectionFactory queueConnectionFactory
                    = (QueueConnectionFactory) ic.lookup("jms/__defaultConnectionFactory");
            QueueConnection con = queueConnectionFactory.createQueueConnection();
            Queue queue = (Queue) ic.lookup("jms/QueueSample");
            QueueSession qs = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
            QueueSender sender = qs.createSender(queue);
            TextMessage message = qs.createTextMessage("LOL");
            message.setStringProperty("Time", String.valueOf(new SimpleDateFormat("dd-MM-yyyy-h-m-s").format(new Date().getTime())));
            sender.send(message);
            con.close();


        %>

        <a href="monitor_.jsp">Monitor</a>

    </body>
</html>
